Sometimes delivery fails, often with the generic error message ‘Sending failed; SMTP protocol error’. Enabling one or both of the following variables and inspecting a trace buffer will often give clues to the reason for the error.
smtpmail-debug-infosmtpmail-debug-info controls whether to print the
SMTP protocol exchange in the minibuffer, and retain the entire
exchange in a buffer ‘*trace of
SMTP session to server*’, where server is the
name of the mail server to which you send mail.smtpmail-debug-verbsmtpmail-debug-verb controls whether to send the
VERB token to the server. The VERB
server instructs the server to be more verbose, and often also
to attempt final delivery while your SMTP session is still
running. It is usually only useful together with
smtpmail-debug-info. Note that this may cause mail
delivery to take considerable time if the final destination
cannot accept mail.